<template>
  <div class="about">
    <h1>This is an about page</h1>
    <b>{{food}}</b>
  </div>
</template>

<script>
export default {
  props: {
    food: {
      type: String,
      default: 'apple'
    }
  },
  //   独享路由守卫
  beforeRouteEnter(to, from, next) {
    next(vm=>{
      console.log(vm)
      // alert('你进入了about页')
    })
  },
  // beforeRouteLeave (to, from, next) {
  //   const leave = confirm('您确定要离开吗？')
  //   if(leave){
  //       next()
  //   }else{
  //     next(false)
  //   }
  // }
}
</script>
